package com.cmz.tank;

import java.awt.*;

/**
 * @author summer
 * @create 2020-02-10 16:44
 * tank爆炸
 */
public class Explode {
    public static int WIDTH = ResourceMgr.explodes[0].getWidth();
    public static int HEIGHT = ResourceMgr.explodes[0].getHeight();

    private int x, y;

//    private boolean living = true;
    TankFrame tf = null;

    private int step = 0;

    public Explode(int x, int y, TankFrame tf) {
        this.x = x;
        this.y = y;
        this.tf = tf;
//        new Audio("audio/explode.wav").run();
    }


    public void paint(Graphics g) {
        g.drawImage(ResourceMgr.explodes[step++], x, y, null);
        if (step >= ResourceMgr.explodes.length) // 爆炸所有图片显示完毕
            tf.explodes.remove(this);
    }
}

